package com.itheima.travel.dao;

import com.itheima.travel.pojo.Route;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RouteMapper {
    /**
     * rflag: 标识当前线路是否下架
     *      1: 表示未下架
     *      0: 表示已下架
     * @param cid
     * @return
     */
    @Select("select count(*) from tab_route where cid = #{cid} and rflag=1 ")
    int findTotalCount(@Param("cid") String cid);

    @Select("select * from tab_route where cid = #{cid} and rflag=1 limit #{startIndex},#{pageSize}")
    List<Route> findRouteByPage(@Param("startIndex") int startIndex,
                                @Param("pageSize") int pageSize,
                                @Param("cid") String cid);
}
